<template>
  <div class="spotCheck h100">
    <iframe
      class="reports__iframe"
      id="workflow"
      name="myFrame"
      frameborder="0"
      width="100%"
      height="100%"
      ref="iframe"
      :src="iframeUrl"
    ></iframe>
  </div>
</template>

<script>
import {getAddressPre,getAddressAfter} from "@/api/orderManagement/spotCheck.js"
export default {
  props: {},
  data() {
    return {
      iframeUrl:'',//'http://10.11.228.110:8075/webroot/decision/view/report?viewlet=order%252F%25E6%25B6%2588%25E7%25BC%25BA%25E5%258F%258A%25E6%2597%25B6%25E7%258E%2587.cpt&ref_t=design&ref_c=9fa400df-98cc-4233-9646-7bb1db0d8c2d'
    };
  },
  created() {
    this.init();
  },
  mounted() {
    
  },
  methods: {
    init() {
      this.getAddress()
    },
    getAddress(){
      getAddressPre().then(res =>{
        if(res.code ==200){
          this.urlPre = res.data
          this.getAfterAddress()
        }
      }).catch(err =>{
        this.$message.error(err)
      })
    },
    getAfterAddress(){
      let param = {
        classifyCode:'order',
        code:'delDefectTimelyRate'
      }
      getAddressAfter(param).then(res =>{
        if(res.code ==200){
          let currentData = res.data.configDetailList.find(item =>{
            return item.appid == this.$store.getters.currentAppInfo.appId
          })
          if(currentData){
            this.iframeUrl = this.urlPre + currentData.value
          }else{
            this.$message.warning('当前水司数据不存在！')
          }
        }
      }).catch(err =>{
        this.$message.error(err)
      })
    }
  }
};
</script>

<style lang="less" scoped>
.spotCheck{
   height: 100%;
  .reports__iframe {
    height: 100%;
    min-height: 400px;
  }
}
</style>